<?php

/*
	[Discuz!] (C)2001-2009 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: notice.php 20815 2009-10-24 09:05:29Z monkey $
*/

define('CURSCRIPT', 'connect_setting');
define('NOROBOT', TRUE);

require_once './include/common.inc.php';
require_once DISCUZ_ROOT.'./include/misc.func.php';
require_once DISCUZ_ROOT.'./include/login.func.php';
require_once DISCUZ_ROOT.'./uc_client/client.php';
require_once(DISCUZ_ROOT.'./include/renren.func.php');


$bindType=$_GET['bindType'];
$discuz_action = 102;
if(!$discuz_uid) {
	showmessage('not_loggedin', NULL, 'NOPERM');
}
if($_COOKIE["isRenRenLogin"]||$_DCOOKIE["isRenRenLogin"])
{
	$renren_uid = $_COOKIE[$apikey."_user"];
}


$converseBind=$_COOKIE["converseBind"];
if(!$bindType)
{
if(!$renren_uid||$converseBind)
{
$renrenUid = $db->result_first("SELECT xnuid FROM {$tablepre}renren_discuz WHERE dzuid='$discuz_uid' and tag=1");
 if($renrenUid)
	{
		
      $bindType="dhbr";
	
	}
	else
	{
		
		$isDefaultUid = $db->result_first("SELECT xnuid FROM {$tablepre}renren_discuz WHERE defdzuid='$discuz_uid' and tag=0");
		if($isDefaultUid)
		{
			$bindType="default";
		}
		else
		{
			$bindType="dbr";
		}
		 
	}
}
elseif($renren_uid)
{
$isBind = $db->result_first("SELECT tag FROM {$tablepre}renren_discuz WHERE xnuid='$renren_uid'");
	if($isBind)
	{
		
      $bindType="rhbd";
	}
	else
	{
		
      $bindType="rbd";
	}
}
}


if($bindType==="dhbr")
{
$renrenUid = $db->result_first("SELECT xnuid FROM {$tablepre}renren_discuz WHERE dzuid='$discuz_uid' and tag=1");

$user_info = rr_get_user_info($renrenUid);
$renrenName=$user_info->name;
global $renrenName;
}
if($bindType==="rhbd")
{

$user_info = rr_get_user_info($renren_uid);
$renrenName=$user_info->name;
global $renrenName;
}
if($bindType==="rbd2"||$bindType==="dbr2")
{
	$user_info = rr_get_user_info();
	$headurl_with_logo = $user_info->headurl_with_logo;	
	$renrenName=$user_info->name;
	global $headurl_with_logo,$renrenNam;
}

include template('connect_setting');

?>